import apiClient from '@/api/apiClient';

interface UserSearchResponse {
  code: number;
  data: {
    id: number;
    nickname: string;
    avatar: string;
  } | null;
  msg: string;
}

/**
 * 搜索用户信息
 * @param phoneNumber 用户手机号
 * @returns 用户信息
 */
export const searchUser = async (phoneNumber: string): Promise<any> => {
  try {
    // 这里替换为实际的API路径和参数
    const response = await apiClient.get<UserSearchResponse>(
      "/h5/search_phone",
      {
        params: { phone: phoneNumber },
      }
    );

    return response;
  } catch (error) {
    console.error("搜索用户失败:", error);
    throw new Error("搜索用户失败，请重试");
  }
};
